/**
 * @FilePath: \ros2\src\tools\plc_bridge\include\plc_bridge.h
 * @Date: 2025-06-11 10:17:55
 * @Description:  
 * @Author: haibo
 * @Version: 1.0.0
 * @LastEditors: haibo.yang haibo.yang@sdlg.com.cn
 * @LastEditTime: 2025-06-11 11:34:05
 * @Copyright (c) 2025 by 临工智能信息科技有限公司, All Rights Reserved. 
**/
#pragma once
#include <cstring>
#include <cstdint>

struct WriteToPLCStruct {
    // VehicleNavigator_T
    struct {
        uint64_t taskid;
        uint32_t subtaskid;
        uint32_t fromnode;
        uint32_t tonode;
        float fprogress;
        float fprogpercent;
        float curpst_x;
        float curpst_y;
        float curpst_t;
        float curvel_x;
        float curvel_z;
        uint8_t vellevel;
        float fdevprog;
        float fdev;
        float fdevthita;
        float fquality;
        int32_t event;
        uint8_t workstate;
        uint8_t wheelmovedir;
        int8_t trajtype;
        uint8_t locatetype;
        char scenes[80];
        uint16_t bits;
        int32_t word1;
        int32_t word2;
        int32_t pathword1;
        int32_t pathword2;
        uint8_t rackfollowup;
        uint8_t navigationtype;
        bool driving;
        bool startdelay;
        bool paused;
        bool idle;
        char orderidnew[80];
        uint32_t orderupdateidnew;
        char nodeidnew[80];
    } VehicleNavigator;

    // VehicleMode_T
    struct {
        uint8_t mode;
    } VehicleMode;

    // VehicleEvent_T
    struct {
        int16_t type;
        int16_t action;
        int16_t ackreq;
        double eventtime;
        double vellimit;
        int32_t ecode;
        int32_t param1;
        int32_t param2;
        int32_t param3;
        int32_t param4;
    } VehicleEvent;

    // IO_T
    struct {
        uint8_t digitaloutput0;
        uint8_t digitaloutput1;
        uint8_t digitaloutput2;
        uint8_t digitaloutput3;
    } IO;
};

struct ReadFromPLCStruct {
    struct {
        uint8_t digitalinput0;
        uint8_t digitalinput1;
        uint8_t digitalinput2;
        uint8_t digitalinput3;
        int16_t AnalogInput0;
        int16_t AnalogInput1;
        int16_t AnalogInput2;
        int16_t AnalogInput3;
    } IO;
};